<?php

if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );

/**
*
* @package  RealEstateManager
* @copyright 2011 Andrey Kvasnevskiy-OrdaSoft(akbet@mail.ru); Rob de Cleen(rob@decleen.com); 
* Homepage: http://www.ordasoft.com
* @version: 2.1 free $
*
**/

class mosRealEstateManagerOthers{

	/**
	 * Sets the parametes for connecting to a webservice via a 
	 * @param the array of parameters
	 * @deprecated $Revision: 1.0 $ - December 2007
	 */
	function setParams()
        {

//echo '2222: ';exit;
	
		global $realestatemanager_configuration;
		// Prepare settings
		// Using single quotes is easier because you don't have to escape them. For every setting, add a line.
		$settings = "<?php\n";

		$settings .= "// Do not edit this file. Generated by admin script.\n";
		$settings .= "// RealEstateManager Configuration file\n";
		$settings .= "// General Informations \n";
		$settings .= "\$realestatemanager_configuration['release']['version']='" . $realestatemanager_configuration['release']['version'] ."';\n";
		$settings .= "\$realestatemanager_configuration['release']['date']='" . $realestatemanager_configuration['release']['date'] ."';\n";
		$settings .= "// edit house \n";

		$settings .= "\$realestatemanager_configuration['edithouse']['default']['lang']='" . $realestatemanager_configuration['edithouse']['default']['lang']  . "';\n";
		$settings .= "// review settings\n";
		$settings .= "\$realestatemanager_configuration['reviews']['show']='" . $realestatemanager_configuration['reviews']['show'] ."';\n";
		$settings .= "\$realestatemanager_configuration['reviews']['registrationlevel']='" . $realestatemanager_configuration['reviews']['registrationlevel'] ."';\n";
    $settings .= "// price settings\n";
    $settings .= "\$realestatemanager_configuration['price']['show']='" . $realestatemanager_configuration['price']['show'] ."';\n";
     $settings .= "// rent settings\n";
    $settings .= "\$realestatemanager_configuration['rentstatus']['show']='" .
            $realestatemanager_configuration['rentstatus']['show'] . "';\n";
    $settings .= "\$realestatemanager_configuration['rentrequest']['registrationlevel']='" .
            $realestatemanager_configuration['rentrequest']['registrationlevel'] . "';\n";    

    $settings .= "// buy settings\n";
    $settings .= "\$realestatemanager_configuration['buystatus']['show']='" .
            $realestatemanager_configuration['buystatus']['show'] . "';\n";
    $settings .= "\$realestatemanager_configuration['buyrequest']['registrationlevel']='" .
            $realestatemanager_configuration['buyrequest']['registrationlevel'] . "';\n";    
            
    $settings .= "// edoc settings\n";
		$settings .= "\$realestatemanager_configuration['edocs']['allow']='" . $realestatemanager_configuration['edocs']['allow'] ."';\n";
		$settings .= "\$realestatemanager_configuration['edocs']['show']='" . $realestatemanager_configuration['edocs']['show'] ."';\n";
		$settings .= "\$realestatemanager_configuration['edocs']['registrationlevel']='" . $realestatemanager_configuration['edocs']['registrationlevel'] ."';\n";
		$settings .= "\$realestatemanager_configuration['edocs']['location']='" . $realestatemanager_configuration['edocs']['location'] ."';\n";
		$settings .= "// debuging\n";
		$settings .= "\$realestatemanager_configuration['debug']='" . $realestatemanager_configuration['debug'] . "';\n";
		$settings .= "\$realestatemanager_configuration['page']['items']='" . $realestatemanager_configuration['page']['items'] . "';\n";
	
		//add for show in category picture
		$settings .= "// show in category picture\n";
		$settings .= "\$realestatemanager_configuration['cat_pic']['show']='" .
      $realestatemanager_configuration['cat_pic']['show'] ."';\n";

    //add for show subcategory 
    $settings .= "// show subcategory\n";
    $settings .= "\$realestatemanager_configuration['subcategory']['show']='" .
       $realestatemanager_configuration['subcategory']['show'] ."';\n";

    //add for google Map key 
    $settings .= "//google Map key\n";
    $settings .= "\$realestatemanager_configuration['google_map']['key']='" .
       $realestatemanager_configuration['google_map']['key'] ."';\n";
    
//view type house
        $settings .= "//view type\n";
        $settings .= "\$realestatemanager_configuration['view_type']='" .
                $realestatemanager_configuration['view_type'] . "';\n";    
    
    

         //update
        $settings .= "//update\n";
        $settings .= "\$realestatemanager_configuration['update']='" .
                $realestatemanager_configuration['update'] . "';\n";
        $settings .= "?>";

		// Write out new initialization file
		$fd = fopen("./components/com_realestatemanager/admin.realestatemanager.class.conf.php", "w" )
		or die ("Cannot create configuration file.");
		fwrite( $fd, $settings );
		fclose( $fd );
	}

	/**
	 * Rating Array
	 * @return array an Array containing the information of all Rating
	 * possibilities
	 */
	function getRatingArray(){
		$i = 0;
		$retVal = array();
		while($i < 5){
			//erster teil x,0
			$tmp = $i * 2;
			array_push($retVal, array($tmp, $i.",0"));
			//zweiter teil x,5
			$tmp ++;
			array_push($retVal, array($tmp, $i.",5"));
			$i ++;
		}
		array_push($retVal, array(10, "10,0"));
		return $retVal;
	}
	
	/**
	 * Language Array - defined in the language files!
	 * @return array an Array containing the information of all Language
	 * possibilities
	 */
	function getLanguageArray(){
              $retVal = array();
              array_push($retVal, array("Not specified", _REALESTATE_MANAGER_LANGUAGE_NOT_USED));
              array_push($retVal, array("Danish", _REALESTATE_MANAGER_LANGUAGE_DK));
              array_push($retVal, array("Dutch", _REALESTATE_MANAGER_LANGUAGE_DUT));
              array_push($retVal, array("English", _REALESTATE_MANAGER_LANGUAGE_ENG));
              array_push($retVal, array("French", _REALESTATE_MANAGER_LANGUAGE_FRE));
              array_push($retVal, array("German", _REALESTATE_MANAGER_LANGUAGE_GER));
              array_push($retVal, array("Italian", _REALESTATE_MANAGER_LANGUAGE_ITA));
              array_push($retVal, array("Russian", _REALESTATE_MANAGER_LANGUAGE_RUS));
  
              array_push($retVal, array("Spanish",_REALESTATE_MANAGER_LANGUAGE_SPA));
              
              return $retVal;
	}
	
} 

